1. Field of the Invention
The present invention relates to an image processing apparatus for quantizing an image, an image processing method, and a medium storing an image processing program.
2. Description of the Related Art
In recent years, along with the advance of digitization of information, systems that scan paper documents using a scanner or the like to convert them into digital document images and save the digital document images instead of saving the paper documents intact, and transmit such digital document image data to other apparatuses, have prevailed. In such systems, in order to reduce transmission cost at the time of transmission, high compressibility is often required for digital documents. Also, reusability that allows partial editing of digital data, and high image quality that can assure high image quality even after enlargement or reduction are required. However, when a document image includes both a text region and photo region, if compression suited to a text region is applied, high image quality is assured but the compression ratio is low. On the other hand, if compression suited to a photo region is applied, a high compression ratio is assured but character legibility deteriorates. Hence, it is difficult to simultaneously meet both high image quality and high compressibility requirements.
However, in recent years, a technique has been proposed which separates a digital document image into text and photo regions, converts, into vector data, the text region for which the reusability and high image quality are to be emphasized, compresses the photo region or the like which cannot be easily reproduced by vector conversion, and composites and outputs the compression results of the respective regions. Also proposed is a technique for converting, into vector data, a specific image (an illustration and characters) which is included in an image that is compressed so far as a photo, and has features (e.g., such specific image is clear like an edge of an object, and has a limited number of colors). In recent years, these techniques have allowed the realization of high compressibility, high image quality, and reusability for document images.
In such situations, a vector conversion processing target is not limited to the aforementioned scan image of the paper document. For example, after an image on a paper document, whiteboard, or the like is captured using a digital camera, the image is then transmitted to a server or the like, which applies automatic corrections of a distortion and luminosity level to the image. Then, the corrected image is converted into a PDF image or vector data, which is easy to view, and the PDF image or vector data is saved.
In particular, characters and figures written on a whiteboard have features of the aforementioned specific image (an illustration and characters), that is, the number of colors of pens for the whiteboard is limited, and the boundaries (edges) between a background and brushstrokes are clear. Therefore, a captured image of the whiteboard is well-suited for conversion into vector data. Hence, an input image of a digital camera is separated into regions for respective colors based on color features, and edge lines of respective color regions are converted into vector data, so as to realize the high compressibility, high image quality, and reusability of the input image of the digital camera.
However, since illumination nonuniformity readily occurs due to, for example, light from a camera flash used at capture time using a digital camera, an illustration portion and a background portion having similar colors are extracted as one region upon extraction of regions for respective colors, and an illustration cannot be cleanly extracted. Especially when an input image is a grayscale image, since there are many illustration portions and background portions having similar density values, an illustration and background cannot be separated.
In order to solve this problem, for example, vector conversion processing may be executed after luminosity correction processing is fir applied to an input image of a digital camera.
On the other hand, it is common practice to correct an image using luminosity correction processing, and Japanese Patent Laid-Open No. 2007-233433 describes an image processing apparatus which can correct an illuminance level of an image using Retinex processing. However, although such luminosity correction processing can remove illumination nonuniformity to some extent, the influence of illumination nonuniformity often remains on an image with a large luminosity change. Consequently, the aforementioned problem is posed as a result of the vector conversion processing.
For example, when a flash is used upon image capture of a whiteboard using a digital camera, an image with a large luminosity change is generated. Therefore, a phenomenon whereby a white background of a dark portion (a position far from the flash) has a similar luminosity level to characters of a bright portion (a position close to the flash) may occur in neighboring regions. That is, pixels to be clustered into different clusters have undesirably similar pixel values under the influence of illumination. Therefore, when such an image is quantized and clustered (into a background and a plurality of types of foregrounds based on quantized pixel values), pixels to be clustered into different clusters are clustered into an identical cluster. For example, when multi-valued quantization is applied to pixel values on an image shown in FIG. 7, an upper right background portion has a quantized pixel value equal to an upper left blurred character portion, and they are clustered into an identical cluster. Note that FIG. 6 is a partially enlarged view of the results obtained when the image shown in FIG. 7 is divided into grid-like regions each having a predetermined size, and the respective grid-like regions are quantized.